package com.clannad.staservice.schedule;

import com.clannad.staservice.service.StatisticsDailyService;
import com.clannad.staservice.utils.DateUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Api(tags = {"定时任务"})
public class ScheduledTask {
    @Autowired
    private StatisticsDailyService service;

    @Scheduled(cron="0 0 1 * * ?")
    public void task(){
        service.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(),-1)));
    }
}
